<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title></title>
</head>
<body>
<script type="text/javascript">
// 定义父类
var Player = function (x, y) {
	this.x = x;
	this.y = y;
	// 这里省略了10000行代码
}
// 定义父类原型
Player.prototype = {
	getPos: function () {
		return [this.x, this.y];
	}
}
// 定义子类
// 构造函数式继承
var Sprite = function (x, y, title) {
	Player.call(this, x, y)
	this.title = title;
}
// 如果子类继承了父类，那么就有了getPos的方法
Sprite.prototype = new Player();

// 实例化精灵
var sp = new Sprite(10, 20, '小精灵');
console.log(sp)
</script>
</body>
</html>